package com.san.hkhospital.service.impl;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.san.hkhospital.mapper.TypeMapper;
import com.san.hkhospital.entity.Type;
import com.san.hkhospital.entity.TypeExample;
import com.san.hkhospital.service.TypeService;
import org.springframework.transaction.annotation.Transactional;

/**
 * ClassName:TypeServiceImpl
 * PackageName:com.san.hkhospital.service.impl
 * Description:
 *
 * @Author:yy
 * @CreatedAt:2024/11/13 14:38
 * 
 */
 
 @Transactional
@Service
public class TypeServiceImpl implements TypeService{

    @Resource
    private TypeMapper typeMapper;

    @Override
    public long countByExample(TypeExample example) {
        return typeMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(TypeExample example) {
        return typeMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer typeId) {
        return typeMapper.deleteByPrimaryKey(typeId);
    }

    @Override
    public int insert(Type record) {
        return typeMapper.insert(record);
    }

    @Override
    public int insertSelective(Type record) {
        return typeMapper.insertSelective(record);
    }

    @Override
    public List<Type> selectByExample(TypeExample example) {
        return typeMapper.selectByExample(example);
    }

    @Override
    public Type selectByPrimaryKey(Integer typeId) {
        return typeMapper.selectByPrimaryKey(typeId);
    }

    @Override
    public int updateByExampleSelective(Type record,TypeExample example) {
        return typeMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(Type record,TypeExample example) {
        return typeMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(Type record) {
        return typeMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Type record) {
        return typeMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Type> typeList() {
       TypeExample example =new TypeExample();
       example.createCriteria().andTypeTypeEqualTo("账户");
        // 获取所有类型
        return typeMapper.selectByExample(example);


    }

    @Override
    public List<Type> payinType() {
        TypeExample example = new TypeExample();
        example.createCriteria().andTypeTypeEqualTo("收入");

        return typeMapper.selectByExample(example);
    }

    @Override
    public List<Type> payoutType() {
        TypeExample example = new TypeExample();
        example.createCriteria().andTypeTypeEqualTo("支出");

        return typeMapper.selectByExample(example);
    }

    @Override
    public List<Type> medicineType() {
        return typeMapper.selectAll();
    }
}
